<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>CRT 显示器模拟</title>
    <style>
      * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
      }

      /* 设置背景色 */
      body {
        padding: 40px;
        background-color: #000;
        width: 100vw;
        height: 100vh;
        overflow: hidden;
        box-sizing: border-box;
      }

      /* CRT 屏幕容器 */
      .crt-container {
        position: fixed;
        /* transform: translate(-50%, -50%); */
        width: 100%;
        height: 100%;
        background: #111;
        border-radius: 30px;
        box-shadow: 0 0 15px rgba(255, 255, 255, 0.5); /* 模拟屏幕的发光效果 */
        overflow: hidden;
        position: relative;
        box-sizing: border-box;
      }

      /* 扫描线效果 */
      .scan-line {
        position: absolute;
        width: 100%;
        height: 2px; /* 设置扫描线的高度 */
        background-color: rgba(255, 255, 255, 0.2); /* 轻微透明的扫描线 */
        opacity: 0.5;
        animation: scan-line-animation 2s linear infinite; /* 循环动画 */
      }

      /* 扫描线动画，模拟屏幕逐行刷新 */
      @keyframes scan-line-animation {
        0% {
          top: -5%; /* 从屏幕上方之外开始 */
        }
        100% {
          top: 105%; /* 到达屏幕下方之外 */
        }
      }

      /* 噪声效果 */
      .noise {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        opacity: 0.05;
        pointer-events: none; /* 防止干扰其他元素的交互 */
      }

      /* 模拟屏幕的扭曲效果 */
      .crt-container img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        filter: contrast(120%) brightness(80%) sepia(20%) hue-rotate(10deg);
        transform: perspective(500px) rotateX(5deg) rotateY(5deg);
      }
    </style>
  </head>
  <body>
    <div class="crt-container">
      <!-- 只有一条扫描线 -->
      <div class="scan-line"></div>

      <!-- 噪声效果 -->
      <div class="noise"></div>
    </div>
  </body>
</html>
